home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / appkit / graphics.h < prev    next >
Text File  |  1994-03-30  |  6KB  |  173 lines

  1. /*
  2.     graphics.h
  3.     Application Kit, Release 2.0
  4.     Copyright (c) 1988, 1989, 1990, NeXT, Inc.  All rights reserved. 
  5. */
  6.  
  7. #import "color.h"
  8.  
  9. /* This file defines the most primitive client graphic structures. */
  10.  
  11. #ifndef GRAPHICS_H
  12. #define GRAPHICS_H
  13.  
  14. #ifndef EVENT_H
  15. #import <dpsclient/dpsfriends.h>
  16. #import <dpsclient/event.h>
  17. #endif EVENT_H
  18.  
  19. #ifndef OBJC_INCL
  20. #import <objc/objc.h>
  21. #endif OBJC_INCL
  22.  
  23. #import <objc/typedstream.h>
  24.  
  25. #define    NX_WHITE    (1.0)
  26. #define    NX_LTGRAY    (2.0/3.0)
  27. #define    NX_DKGRAY    (1.0/3.0)
  28. #define    NX_BLACK    (0.0)
  29.  
  30. typedef struct _NXRect {    /* rectangle */
  31.     NXPoint         origin;
  32.     NXSize          size;
  33. } NXRect;
  34.  
  35. #define    NX_X(aRect)    ((aRect)->origin.x)
  36. #define    NX_Y(aRect)    ((aRect)->origin.y)
  37. #define    NX_WIDTH(aRect)    ((aRect)->size.width)
  38. #define    NX_HEIGHT(aRect)    ((aRect)->size.height)
  39. #define    NX_MAXX(aRect)    ((aRect)->origin.x + (aRect)->size.width)
  40. #define    NX_MAXY(aRect)    ((aRect)->origin.y + (aRect)->size.height)
  41. #define    NX_MIDX(aRect)    (NX_X(aRect)+NX_WIDTH(aRect)/2.0)
  42. #define    NX_MIDY(aRect)    (NX_Y(aRect)+NX_HEIGHT(aRect)/2.0)
  43.  
  44. /* The sides of a rectangle */
  45. #define NX_XMIN    0
  46. #define NX_YMIN    1
  47. #define NX_XMAX    2
  48. #define NX_YMAX    3
  49.  
  50. /*
  51.  * The following values should be used in describing color space of bitmaps.
  52.  */
  53. typedef enum _NXColorSpace { 
  54.     NX_CustomColorSpace = -1,        /* color space from graphics state */
  55.     NX_OneIsBlackColorSpace = 0,    /* monochrome, 1 is black */
  56.     NX_OneIsWhiteColorSpace = 1,    /* monochrome, 1 is white */
  57.     NX_RGBColorSpace = 2,            
  58.     NX_CMYKColorSpace = 5
  59. } NXColorSpace;
  60.  
  61. /*
  62.  * NXWindowDepth defines the values used in setting window depth limits.
  63.  * Use the functions NXBPSFromDepth() and NXColorSpaceFromDepth()
  64.  * to extract colorspace/bps info from an NXWindowDepth.
  65.  */
  66. typedef enum _NXWindowDepth { 
  67.     NX_DefaultDepth = 0,
  68.     NX_TwoBitGrayDepth = 258,
  69.     NX_EightBitGrayDepth = 264,
  70.     NX_EightBitRGBDepth = 514,
  71.     NX_TwelveBitRGBDepth = 516,
  72.     NX_TwentyFourBitRGBDepth = 520
  73. } NXWindowDepth;
  74.  
  75.  
  76. extern NXColor NXReadPixel(const NXPoint *p);
  77. extern void NXCopyBits(int sgnum, const NXRect *sRect, const NXPoint *dPoint);
  78. extern void NXDrawButton(const NXRect *aRect, const NXRect *clipRect);
  79. extern void NXDrawGrayBezel(const NXRect *aRect, const NXRect *clipRect);
  80. extern void NXDrawGroove(const NXRect *aRect, const NXRect *clipRect);
  81. extern NXRect *NXDrawTiledRects(NXRect *boundsRect, const NXRect *clipRect,
  82.         const int *sides, const float *grays, int count);
  83. extern void NXDrawWhiteBezel(const NXRect *aRect, const NXRect *clipRect);
  84. extern void NXEraseRect(const NXRect *aRect);
  85. extern void NXFrameRect(const NXRect *aRect);
  86. extern void NXFrameRectWithWidth(const NXRect *aRect, NXCoord frameWidth);
  87. extern void NXRectClip(const NXRect *aRect);
  88. extern void NXRectClipList(const NXRect *rects, int count);
  89. extern void NXRectFill(const NXRect *aRect);
  90. extern void NXRectFillList(const NXRect *rects, int count);
  91. extern void NXHighlightRect(const NXRect *aRect);
  92. extern void NXRectFillListWithGrays(const NXRect *rects, const float *grays, int count);
  93.  
  94. extern BOOL NXContainsRect(const NXRect *a, const NXRect *b);
  95. extern NXRect *NXDivideRect(NXRect *aRect, NXRect *bRect, NXCoord slice, int edge);
  96. extern BOOL NXEmptyRect(const NXRect *aRect);
  97. extern BOOL NXEqualRect(const NXRect *aRect, const NXRect *bRect);
  98. extern void NXInsetRect(NXRect *aRect, NXCoord dX, NXCoord dY);
  99. extern void NXIntegralRect(NXRect *aRect);
  100. extern NXRect *NXIntersectionRect(const NXRect *aRect, NXRect *bRect);
  101. extern BOOL NXIntersectsRect(const NXRect *aRect, const NXRect *bRect);
  102. extern void NXOffsetRect(NXRect *aRect, NXCoord dX, NXCoord dY);
  103. extern BOOL NXPointInRect(const NXPoint *aPoint, const NXRect *aRect);
  104. extern BOOL NXMouseInRect(const NXPoint *aPoint, const NXRect *aRect, BOOL flipped);
  105. extern void NXSetRect(NXRect *aRect, NXCoord x, NXCoord y, NXCoord w, NXCoord h);
  106. extern NXRect *NXUnionRect(const NXRect *aRect, NXRect *bRect);
  107.  
  108. extern NXColorSpace NXColorSpaceFromDepth (NXWindowDepth depth);
  109. extern int NXBPSFromDepth (NXWindowDepth depth);
  110. extern int NXNumberOfColorComponents (NXColorSpace colorSpace);
  111. extern BOOL NXGetBestDepth (NXWindowDepth *depth, int numColors, int bps);
  112.  
  113. extern void NXPing(void);
  114.  
  115. extern void NXDrawBitmap(const NXRect *rect, int width, int height,
  116.             int bps, int spp, int bpp, int bpr, 
  117.             BOOL isPlanar, BOOL hasAlpha, NXColorSpace colorSpace,
  118.             const unsigned char *const data[5]);
  119.  
  120. extern void NXReadBitmap(const NXRect *rect, int w, int h, int bps, int spp, 
  121.                 int planarConfig, int photoInt,
  122.                 void *data1, void *data2, void *data3,
  123.                 void *data4, void *data5 );
  124.  
  125. extern void NXSizeBitmap(const NXRect *rect, int *size, int *width, 
  126.     int *height, int *bps, int *spp, int *planarConfig, int *photoInt );
  127.  
  128. extern void NXCopyBitmapFromGState (int srcGState,
  129.                     const NXRect *srcRect,
  130.                     const NXRect *destRect);
  131.  
  132. extern void NXWritePoint (NXTypedStream *s, const NXPoint *aPoint);
  133.     /* Equivalent to NXWriteTypes (s, "ff", &aPoint.x, &aPoint.y) */
  134. extern void NXReadPoint (NXTypedStream *s, NXPoint *aPoint);
  135.  
  136. extern void NXWriteSize (NXTypedStream *s, const NXSize *aSize);
  137.     /* Equivalent to NXWriteTypes (s, "ff", &aSize.width, &aSize.height) */
  138. extern void NXReadSize (NXTypedStream *s, NXSize *aSize);
  139.  
  140. extern void NXWriteRect (NXTypedStream *s, const NXRect *aRect);
  141.     /* Equivalent to NXWriteArray (s, "f", 4, &aRect) */
  142. extern void NXReadRect (NXTypedStream *s, NXRect *aRect);
  143.  
  144. /*
  145.  * NXContainRect() is obsolete and used in the 1.0 API.
  146.  */
  147. extern int NXContainRect(NXRect *aRect, const NXRect *bRect);
  148.  
  149. /*
  150.  * The following four constants are obsolete and used in the 1.0 API. 
  151.  * Use NXColorSpace instead.
  152.  */
  153. #define NX_MONOTONICMASK    1
  154. #define NX_COLORMASK        2
  155. #define NX_ALPHAMASK        4
  156. #define NX_PALETTEMASK        8
  157.  
  158. /*
  159.  * The following two constants are obsolete and used in the 1.0 API to
  160.  * describe planar configuration of bitmaps. 2.0 API uses a boolean (isPlanar) 
  161.  * instead.
  162.  */
  163. #define NX_MESHED        1
  164. #define NX_PLANAR        2    
  165.  
  166. /*
  167.  * #defines for historical reasons; don't use these in new applications.
  168.  */
  169. #define NXWindowDepthType    NXWindowDepth
  170. #define NXColorSpaceType    NXColorSpace
  171.  
  172. #endif GRAPHICS_H
  173.